<?php
require_once('./cherylib.php');
require_once('../src/scottlib.php');

// connecting - will throw an Exception on failure
connect(':/tmp/mysql.sock', 'root', 'password', 'mysql');

$version = val('SELECT @@VERSION');
assert_true(strlen($version));

$rs = select('SELECT @@VERSION as `version`');

assert_true($rs->count() === 1);
assert_true($rs->fieldCount() === 1);

foreach($rs->objects() as $i => $value) {
	assert_equals($version, $value->version);
}
assert_equals($i, 0);
$i = null;

foreach($rs->assocs() as $i => $value) {
	assert_equals($version, $value['version']);
}
assert_equals($i, 0);
$i = null;

foreach($rs->arrays() as $i => $value) {
	assert_equals($version, $value[0]);
}
assert_equals($i, 0);
$i = null;